﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Omega.Editor.Classes
{
    static public class Funcoes
    {

        static public void CreateDirectories()
        {
            CreateDirectory(GetOmegaDefultPath());
            CreateDirectory(GetPlugInPath());

        }

        static public String GetOmegaDefultPath()
        {
            return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
                + @"\Omega 2D Engine\";
        }

        static public String GetPlugInPath()
        {
            return GetOmegaDefultPath() + @"Plugins\";
        }

        static bool CreateDirectory(string aDir, bool oDeleteOld = false)
        {
            bool aDi_Exists = Directory.Exists(aDir);

            if(aDi_Exists  && !oDeleteOld)
                return false;
            
            try
            {
                if (aDi_Exists)
                {
                    Directory.Delete(aDir);
                }
                Directory.CreateDirectory(aDir);
            }
            catch
            {
                return false;
            }
            return true;
        }


    }
}
